package com.aggron.controller;

import com.aggron.common.JsonData;
import com.aggron.entity.SysUser;
import com.aggron.service.ISysUserService;
import com.google.common.collect.Maps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 *
 * 用户登录controller
 * @author   liuhuan on 2018/6/4.
 */
@RestController
@RequestMapping("/auth")
public class AuthController {


    @Autowired
    private ISysUserService iSysUserService;

    @PostMapping("/token")
    public JsonData login(@RequestBody SysUser sysUser)throws Exception{
        return iSysUserService.login(sysUser);
    }

    @GetMapping("currentUser")
    public Object getCurrentUser(){
        Map<String,Object> user= Maps.newHashMap();

        user.put("name","Serati Ma");
        user.put("avatar","https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png");
        user.put("userid","'00000001'");
        user.put("notifyCount",12);
        return user;
    }
}
